using Gateway.Common.Entity;

namespace Gateway.Domain.Entities;

/// <summary>
/// 系统中的 系统设置
/// </summary>
public class SystemSetting : AggregateRootEntityBase
{
    public SystemSetting(string systemName = default, string logoUrl = default, string loginType = default,
        string passwordRegex = default, string copyright = default)
    {
        SystemName = systemName;
        LogoUrl = logoUrl;
        LoginType = loginType;
        PasswordRegex = passwordRegex;
        Copyright = copyright;
    }

    public void Update(string systemName = default, string logoUrl = default, string loginType = default,
        string passwordRegex = default, string copyright = default)
    {
        SystemName = systemName;
        LogoUrl = logoUrl;
        LoginType = loginType;
        PasswordRegex = passwordRegex;
        Copyright = copyright;
    }

    public void SetSms(SystemSms sms)
    {
        if (sms != null)
        {
            this.Sms = sms;
        }
    }

    /// <summary>
    /// 系统名称
    /// </summary>
    public string SystemName { get; set; }

    /// <summary>
    /// LogoUrl
    /// </summary>
    public string LogoUrl { get; set; }

    /// <summary>
    /// 登录开关  all 普通用户+管理员用户  user 普通用户 admin 管理员用户
    /// </summary>
    public string LoginType { get; set; }

    /// <summary>
    /// 密码验证规则
    /// </summary>
    public string PasswordRegex { get; set; }

    /// <summary>
    /// 版权信息
    /// </summary>
    public string Copyright { get; set; }


    /// <summary>
    /// 短信配置
    /// </summary>
    public SystemSms Sms { get; set; }


    public SystemSetting()
    {
    }
}